import request from '@/utils/request';
import store from '@/store'

// 新增节点
export function addNode(data) {
  const params = {
    ...data,
    createUserId: store.getters.userId,
    updateUserId: store.getters.userId
  }
  return request({
    url: '/maintain/maintain/nodeMg/addNode',
    method: 'put',
    data: params
  })
}

// 查询节点列表
export function serachNodeList(data) {
  return request({
    url: '/maintain/maintain/nodeMg/list',
    method: 'get',
    params: data
  })
}
// 查询科研查询节点列表
export function serachResNodeList(data) {
  return request({
    url: '/maintain/maintain/approve/researchList',
    method: 'post',
    params: data
  })
}

// 表格列表编辑
export function editNode(data) {
  const params = {
    ...data,
    updateUserId: store.getters.userId
  }
  return request({
    url: '/maintain/maintain/nodeMg/editNode',
    method: 'put',
    data: params
  })
}

// 表格列表删除
export function deleteNodeList(data) {
  return request({
    url: `/maintain/maintain/nodeMg/deleteNode/${data}`,
    method: 'delete'
  })
}

// 查询节点是否存在挂在页面
export function mountPage(data) {
  return request({
    url: `/maintain/maintain/pageMg/countPage`,
    method: 'get',
    params: data
  })
}